package com.xiaocq.wordskiller;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

public class UnitWrongDetail extends Activity{
	
	private Button backToMenu;
	private TextView unitIndicate;
	private ListView unitWrongSet;
	
	private int unitId;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.unit_wrong_detail);
		Intent intent = getIntent();
		unitId = intent.getIntExtra(CommandList.UNIT_ID, 1);
		
		backToMenu = (Button) findViewById(R.id.unit_wrong_detail_backToMenu);
		unitIndicate = (TextView) findViewById(R.id.unit_wrong_detail_unitIndicate);
		unitWrongSet = (ListView) findViewById(R.id.unit_wrong_detail_wrongWordList);
		
		backToMenu.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				finish();
			}
		});
		
		unitIndicate.setText("List" + unitId);
		
		ActivityHelper helper = new ActivityHelper(UnitWrongDetail.this);
		helper.open();
		Cursor cursor = helper.getUnitWrongData(unitId);
		MyAdapter adapter = new MyAdapter(UnitWrongDetail.this, cursor, false);
		helper.close();
		
		unitWrongSet.setAdapter(adapter);
	}

}
